from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView

from .views import LoginView, GetPersonDetailAPIView, SendCodeAPIView, RegisterAPIView, PersonAdmin, PersonRank
from .views import PersonAPIView, PersonDetailAPIView

urlpatterns = [
    path('', PersonAPIView.as_view()),
    path('<int:pk>', PersonDetailAPIView.as_view()),
    path('login/', LoginView.as_view(), name='login'),
    path('register/', RegisterAPIView.as_view(), name='register'),
    path('token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('token/verify/', TokenVerifyView.as_view(), name='token_verify'),
    path('detail/', GetPersonDetailAPIView.as_view(), name='person_detail'),
    path('saveLuck/', GetPersonDetailAPIView.as_view(), name='person_detail'),
    path('sendCode/', SendCodeAPIView.as_view(), name='send_code'),
    path('rank/', PersonRank.as_view() ,name='person_rank'),


    # 以下是 admin 的方法
    path('list/', PersonAdmin.as_view()),

]
urlpatterns = format_suffix_patterns(urlpatterns)
